package com.liangdemo.web.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 文件操作
 *
 * @author xuxin
 */
@Data
@TableName("upload_file")
public class UploadFile {
    @TableId
    private String id;

    /**
     * 文件名
     */
    private String name;

    /**
     * 文件物理相对路径
     */
    private String path;

    /**
     * 文件大小，默认字节
     */
    private Long size;

    /**
     * 文件是否删除
     */
    @TableField(value = "is_delete")
    private Boolean deleted;

    /**
     * 是否是临时文件
     */
    @TableField(value = "is_temp")
    private Boolean temp;

    @TableField(value = "md5")
    private String md5;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 初始化设置 temp deleted 为 false
     */
    public UploadFile(){
        this.temp = false;
        this.deleted = false;
    }
}
